// 通知服务API专用模块

// 邮件通知接口请求结构
export interface NoticeRequest {
  Title: string;
  Content: string;
  UserNums: string[];
  Type: string;
}

// 响应结构
export interface NoticeResponse {
  success: boolean;
  message?: string;
}

/**
 * 发送通知邮件
 * 使用代理方式解决跨域问题
 */
export const sendNotice = async (noticeData: NoticeRequest): Promise<NoticeResponse> => {
  console.log('发送通知:', noticeData);
  
  try {
    const response = await fetch('/notice-api/notice', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(noticeData)
    });
    
    if (response.ok) {
      return { success: true, message: '反馈已成功提交' };
    } else {
      throw new Error(`HTTP错误: ${response.status}`);
    }
  } catch (error) {
    console.error('发送通知失败:', error);
    return { success: false, message: '提交反馈失败，请稍后再试' };
  }
}; 